import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/components/channel/layout/Layout'
import MainView from '@/components/mainView'
import ChannelList from '@/components/channel/List'
import ChannelGroup from '@/components/channel/Group'
import Login from '@/components/login'

Vue.use(Router)

export const routes = [
  {
    path: '/',
    redirect: '/channelManager/channel/list'
  }, {
    path: '/Login',
    component: Login,
    meta: {
      requiresAuth: true
    }
  }, {
    path: '/channelManager',
    redirect: '/channelManager/channel/list',
    component: Layout,
    name: 'channel',
    meta: {
      subtitle: 'channel'
    },
    children: [
      {
        path: 'channel',
        meta: {
          sidebar: true
        },
        component: MainView,
        children: [
          {
            path: 'list',
            name: 'channel',
            component: ChannelList,
            meta: {
              show: true,
              hideTitle: true
            }
          },
          {
            path: 'group',
            name: 'group',
            component: ChannelGroup,
            meta: {
              show: true,
              hideTitle: true
            }
          }
        ]
      }
    ]
  },
  {
    path: '/groupManager',
    redirect: '/groupManager/group/list',
    component: Layout,
    name: '',
    meta: {
      subtitle: 'group'
    },
    children: [
      {
        path: 'group',
        meta: {
          sidebar: true
        },
        component: MainView,
        children: [
          {
            path: 'list2',
            name: 'ChannelList',
            component: ChannelList,
            meta: {
              show: true,
              hideTitle: true
            }
          }
        ]
      }
    ]
  }
]

export default new Router({ routes })
